//
//  KLOrderHeaderView.m
//  KunLun
//
//  Created by Mac on 2017/11/28.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLOrderHeaderView.h"

@interface KLOrderHeaderView()
@property(nonatomic, strong) STLabel                     *desLable;
@property(nonatomic, strong) STButton                     *iconButton;
@end
@implementation KLOrderHeaderView
+ (CGFloat)headerHeight{
    return 54;
}
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithReuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, [KLOrderHeaderView headerHeight])];
    whiteView.backgroundColor = [UIColor whiteColor];
    [self addSubview:whiteView];
    STButton * iconButton = [[STButton alloc] initWithFrame:CGRectMake(10,  10, UIScreenWidth/2 - 20, 44)
                                                      title:@"千把丢"
                                                 titleColor:KL_firstTextColor
                                                  titleFont:16
                                               cornerRadius:0
                                            backgroundColor:nil
                                            backgroundImage:nil
                                                      image:[UIImage imageNamed:@"我的渠道"]];
    iconButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    [whiteView addSubview:iconButton];
    self.iconButton = iconButton;
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(UIScreenWidth / 2, 0, UIScreenWidth/2 -20, [KLOrderHeaderView headerHeight])
                                              text:@""
                                         textColor:KL_redColor
                                              font:15
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentRight];
   // [whiteView addSubview:self.desLable];
    
}
- (void)setModel:(BLOrderModel *)model{
    _model = model;
    NSString * text ;
    NSString * type ;
    //1，待付款，2待发货，3待收货，4已完成,
    switch (model.state.integerValue) {
        case 0:
            text = @"";
            break;
        case 1:
            text = @"待付款";
            break;
        case 2:
            text = @"待发货";
            break;
        case 3:
            text = @"待收货";
            break;
        case 4:
            text = @"已完成";
            break;
        default:
            break;
    }
    //1布草洗涤，2布草定制，3积分商城，4集采商城,5私人定制
    switch (model.goods_type.integerValue) {
        case 0:
            type = @"";
            break;
        case 1:
            type = @"布草洗涤订单";
            break;
        case 2:
            type = @"布草定制订单";
            break;
        case 3:
            type = @"积分商城订单";
            break;
        case 4:
            type = @"集采商城订单";
            break;
        case 5:
            type = @"私人定制订单";
            break;
        default:
            break;
    }
    [self.iconButton setTitle:[NSString stringWithFormat:@"%@ %@",type,text] forState:UIControlStateNormal];
}

@end
